function res = isnewer (file1, varargin)

   ## usage:  res = isnewer (file1, varargin)
   ##
   ## check if file1 is newer than files in varargin

   tick = 1 ;

   if !exist(file1, "file")
      res = false ;
      return ;
   else
      res = true ;
   endif

   for i = 1:nargin-1
      if isempty(file = varargin{i}), continue ; endif
      res = res && exist(file, "file") && (ageof(file1) > ageof(file) + tick) ;
   endfor

endfunction


function res = ageof (file)

   ## usage:  res = ageof (file)
   ##
   ## determine age of file (newest in case of directory)

   if isdir(file)
      res = 0 ;
      for f = glob([file "/*"])'
	 if islink(f{:}), continue ; endif
	 res = max(res, ageof(f{:})) ;
      endfor
   else
      res = stat(file).mtime ;
   endif

endfunction
